// ml.cpp : This file contains the 'main' function. Program execution begins and ends there.
//

#include <iostream>


#include "mlp.h"
#include "conv2d.h"

int main() {
    //// 1. 创建测试输入：2个样本，每个样本2维特征 → 形状[2,2]
    //Tensor<float> x({ 2, 2 });
    //x.set_data({ 1.0f, 2.0f,  // 第一个样本：[1.0, 2.0]
    //            3.0f, 4.0f }); // 第二个样本：[3.0, 4.0]
    //std::println("测试输入:");
    //x.print("x");  // 打印输入张量


    //// 2. 创建MLP模型并打印层信息
    //MLP<float> model;
    //std::println("\n模型结构:");
    //model.print_layer_info();


    //// 3. 前向传播
    //Tensor<float> output = model.forward(x);
    //std::println("前向传播输出:");
    //output.print("output");  // 输出形状应为[2,1]（2个样本，每个1个输出）


    //// 4. 验证输出范围（Sigmod激活后应在0~1之间）
    //std::println("\n输出范围检查:");
    //for (float val : output.get_data()) {
    //    std::println(" {} (在0~1之间：{}", val, (val >= 0 && val <= 1 ? "是" : "否"));
    //}


    Tensor<float> input({ 1, 3, 5, 5 });
    input.random(0, 1);  // 随机初始化输入特征图
    std::cout << "输入特征图形状: ";
    for (int dim : input.get_shape()) std::cout << dim << " ";  // [1,3,5,5]
    std::cout << "\n";

    // 创建卷积层：3输入通道，8输出通道，3x3 kernel，步长1，填充1
    Conv2d<float> conv(3, 8, 3, 1, 1);
    std::cout << "卷积核形状: ";
    for (int dim : conv.get_kernel().get_shape()) std::cout << dim << " ";  // [8,3,3,3]
    std::cout << "\n";

    // 前向传播
    Tensor<float> output = conv.forward(input);
    std::cout << "输出特征图形状: ";
    for (int dim : output.get_shape()) std::cout << dim << " ";  // [1,8,5,5]（因padding=1，尺寸不变）
    std::cout << "\n";
    return 0;
}
// Run program: Ctrl + F5 or Debug > Start Without Debugging menu
// Debug program: F5 or Debug > Start Debugging menu

// Tips for Getting Started: 
//   1. Use the Solution Explorer window to add/manage files
//   2. Use the Team Explorer window to connect to source control
//   3. Use the Output window to see build output and other messages
//   4. Use the Error List window to view errors
//   5. Go to Project > Add New Item to create new code files, or Project > Add Existing Item to add existing code files to the project
//   6. In the future, to open this project again, go to File > Open > Project and select the .sln file
